﻿#include "mDlgTest1.h"
#include "ui_mDlgTest1.h"
#include "stable.h"




mDlgTest1::mDlgTest1(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::mDlgTest1)
{
    ui->setupUi(this);

//---自定义布局
//{
//    m_pGridLayout = new QGridLayout(this);
//    m_pGridLayout->addWidget( ui->m_pTestWidget1,0,0);
//    m_pGridLayout->addWidget( ui->m_pPushButton1,2,0);
//    m_pGridLayout->addWidget( ui->m_pPushButton2,2,2);
//    m_pGridLayout->addWidget( ui->m_pTestLabel1,3,0,1,3);
//    m_pGridLayout->addWidget( ui->buttonBox,4,1);
//    setLayout(m_pGridLayout);
//}

//    this->setMaximumSize(1000,1000);
//    ui->m_pTestWidget1->setMaximumSize(600,600);
//    ui->m_pPushButton1->setMaximumSize(200,50);
//    ui->m_pPushButton1->setMaximumSize(200,50);
//    ui->m_pTestLabel1->setMaximumSize(600,50);
//    ui->buttonBox->setFixedSize(200,50);

    //---使用ui布局
    setLayout(ui->gridLayout);


//    //---设置控件字体
//    ui->m_pPushButton1->setFont(QFont("新宋体",12));
//    ui->m_pPushButton2->setFont(QFont("新宋体",12));
//    ui->m_pTestLabel1->setFont(QFont("新宋体",12));


    //---创建函数链接
    connect(ui->m_pPushButton1,&QPushButton::clicked,
            [=]()
    {
        int nTempNum = qrand() % 90;
        ui->m_pTestWidget1->SetNum(nTempNum);
    });


    connect(ui->m_pPushButton2,&QPushButton::clicked,
            [=]()
    {
        int nTempNum =  ui->m_pTestWidget1->GetNum();
        ui->m_pPushButton2->setText(QString::number(nTempNum));
    });

}



mDlgTest1::~mDlgTest1()
{
    delete ui;
}
